// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//
#include <pollux/functions/registerer.h>
#include <pollux/functions/lib/registration_helpers.h>
#include <pollux/functions/prestosql/arithmetic.h>
#include <pollux/functions/prestosql/probability.h>

// Register Presto Probability, Trigonometric, and Statistical functions.

namespace kumo::pollux::functions {
    namespace {
        void registerProbTrigFunctions(const std::string &prefix) {
            register_function<CosFunction, double, double>({prefix + "cos"});
            register_function<CoshFunction, double, double>({prefix + "cosh"});
            register_function<AcosFunction, double, double>({prefix + "acos"});
            register_function<SinFunction, double, double>({prefix + "sin"});
            register_function<AsinFunction, double, double>({prefix + "asin"});
            register_function<TanFunction, double, double>({prefix + "tan"});
            register_function<TanhFunction, double, double>({prefix + "tanh"});
            register_function<AtanFunction, double, double>({prefix + "atan"});
            register_function<Atan2Function, double, double, double>({prefix + "atan2"});

            register_function<BetaCDFFunction, double, double, double, double>(
                {prefix + "beta_cdf"});
            register_function<NormalCDFFunction, double, double, double, double>(
                {prefix + "normal_cdf"});
            register_function<BinomialCDFFunction, double, int64_t, double, int64_t>(
                {prefix + "binomial_cdf"});
            register_function<BinomialCDFFunction, double, int32_t, double, int32_t>(
                {prefix + "binomial_cdf"});
            register_function<CauchyCDFFunction, double, double, double, double>(
                {prefix + "cauchy_cdf"});
            register_function<ChiSquaredCDFFunction, double, double, double>(
                {prefix + "chi_squared_cdf"});
            register_function<FCDFFunction, double, double, double, double>(
                {prefix + "f_cdf"});
            register_function<InverseBetaCDFFunction, double, double, double, double>(
                {prefix + "inverse_beta_cdf"});
            register_function<InverseNormalCDFFunction, double, double, double, double>(
                {prefix + "inverse_normal_cdf"});
            register_function<PoissonCDFFunction, double, double, int32_t>(
                {prefix + "poisson_cdf"});
            register_function<GammaCDFFunction, double, double, double, double>(
                {prefix + "gamma_cdf"});
            register_function<LaplaceCDFFunction, double, double, double, double>(
                {prefix + "laplace_cdf"});
            register_function<
                WilsonIntervalUpperFunction,
                double,
                int64_t,
                int64_t,
                double>({prefix + "wilson_interval_upper"});
            register_function<
                WilsonIntervalLowerFunction,
                double,
                int64_t,
                int64_t,
                double>({prefix + "wilson_interval_lower"});

            register_function<WeibullCDFFunction, double, double, double, double>(
                {prefix + "weibull_cdf"});
            register_function<InverseWeibullCDFFunction, double, double, double, double>(
                {prefix + "inverse_weibull_cdf"});
            register_function<InverseCauchyCDFFunction, double, double, double, double>(
                {prefix + "inverse_cauchy_cdf"});
            register_function<InverseLaplaceCDFFunction, double, double, double, double>(
                {prefix + "inverse_laplace_cdf"});
            register_function<InverseGammaCDFFunction, double, double, double, double>(
                {prefix + "inverse_gamma_cdf"});
        }
    } // namespace

    void registerProbabilityTrigonometryFunctions(const std::string &prefix = "") {
        registerProbTrigFunctions(prefix);
    }
} // namespace kumo::pollux::functions
